package Demo.demo9;

import java.util.Scanner;

public class Demo1 {
    //1. 请输入一个字符串，判断里面有多少个连续的af。比如：afdfefareafafetbi3haf，一共有4个af；
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("请输入字符串");
        String a=input.next();

       char[] chars=a.toCharArray();
       int 记数 = 0;
       for (int i =0;i<chars.length;i++){
           if(chars[i]=='a'&&chars[i+1]=='f'){
               记数++;
               i++;
           }
       }
        System.out.println(记数);
    }
}
